import { ref } from "vue";
import type { AvueFormOption } from "@smallwei/avue";

export default function () {
  const option: AvueFormOption = {
    menuBtn: false,
    labelWidth: 110,
    column: [
      {
        prop: "nickname",
        label: "用户名称",
        search: true,
        rules: [
          {
            required: true,
            message: "请输入用户名称",
          },
          {
            type: "string",
            min: 2,
            message: "最少2个字",
          },
        ],
      },
      {
        type: "tree",
        prop: "deptId",
        label: "归属部门",
        dicUrl: "/api/system/dept/treeList",
        props: {
          label: "deptName",
          value: "id",
        },
      },
      {
        prop: "phone",
        label: "手机号码",
      },
      {
        prop: "email",
        label: "邮箱",
      },
      {
        prop: "loginId",
        label: "登录账号",
        display: true,
        rules: [
          {
            required: true,
            message: "请输入用户名称",
          },
          {
            type: "string",
            min: 3,
            message: "最少3个字",
          },
        ],
      },
      {
        prop: "loginPwd",
        label: "登录密码",
        rules: [
          {
            required: true,
            message: "请输入登录密码",
          },
          {
            type: "string",
            min: 6,
            message: "最少6个字",
          },
        ],
      },
      {
        prop: "sex",
        label: "用户性别",
      },
      {
        type: "select",
        prop: "status",
        label: "状态",
        dicUrl: "/api/system/dict/type/optionSelect/sys_status",
        props: {
          label: "dictLabel",
          value: "dictValue",
        },
      },
      {
        prop: "postId",
        label: "岗位",
      },
      {
        type: "select",
        prop: "roleIds",
        label: "角色",
        dataType: "string",
        dicUrl: "/api/system/role/list",
        value: "2",
        props: {
          label: "roleName",
          value: "id",
        },
        rules: [
          {
            required: true,
            message: "请选择角色",
          },
        ],
      },
      {
        type: "textarea",
        prop: "remark",
        label: "备注",
        span: 24,
      },
    ],
  };
  return ref(option);
}
